<?php


namespace App\Http\Controllers\Api;

use App\Http\Controllers\Controller;
use App\Services\ArticleService;
use App\Services\UserAuthService;
use Illuminate\Http\Request;


class ArticleController extends Controller
{
    /**
     * @api {post} api/ip/store 创建
     */
    public function store(Request $request, ArticleService $service) {
        return $service->store($request->input(), true);
    }

    /**
     * @api {get} api/ip/info/{id} 信息
     */
    public function show(ArticleService $service, $id = null) {
        return $service->show($id);
    }

    /**
     * @api {post} api/ip/update/{id} 更新
     */
    public function update(Request $request, ArticleService $service, $id = null) {
        return $service->update($id, $request->input());
    }

    /**
     * @api {post} api/account/destroy 删除
     */
    public function destroy(Request $request, ArticleService $service){
        return $service->destroy($request->input('ids'));
    }

    /**
     * @api {get} api/ip/lists 列表
     */
    public function lists(Request $request, ArticleService $service) {
        return $service->lists($request->query());
    }
}
